package com.sunday.common.sharding.sphere.jdbc.study.base.sync.interrupt;

/**
 * @Description:
 * @Author: zsy
 * @Create: 2023/4/4 15:41
 */
public class SynchronizeAndReentrant {

    /**
     * 不同方法，synchronized是可重入的
     */
    public static void main(String[] args) throws Exception {
        SynchronizeAndReentrant synchronizeAndReentrant = new SynchronizeAndReentrant();
        synchronizeAndReentrant.test1();
    }
    public synchronized void test1(){
        System.out.println(" test1 method is called...");
        test2();
    }

    public synchronized void test2(){
        System.out.println(" test2 method is called...");
    }

}
